1. Field of the Invention
The present invention relates to a method to manage defects of an optical disk. More specifically, a method sets up a plurality of buffers in memory of an optical drive to improve memory use efficiency and defect regulation during optical disk defect management.
2. Description of the Prior Art
Optical disks, due to their small volume and large storage capacity, have become one of the most common volatile data storage media used in modern society. More specifically, development of rewritable optical disks being capable of recording personal data according to a user has largely expanded the flexibility of the use of optical disk. However, defects occur when data is written onto an optical disk. Managing defective areas on an optical disk to maintain the function of recording data concisely has become a focus of the industry.
A drive is required to accesses data in a corresponding optical disk. Please refer to FIG. 1. Illustrated in FIG. 1 is a block diagram regarding a conventional drive 10 accessing an optical disk 22. The drive 10 comprises a motor 12, a pickup head 16, a controller 18, and a memory 20. A user can control the drive 10 by accessing the host 26.
When the optical disk 22 is set on a housing 14, the motor 12 will rotate the optical disk 22, and the pickup head 16 can access data on the optical disk 22 through an exciting laser beam.
The controller 18, a control chip, is applied to control the drive 10. The memory 20, a volatile random access memory, is used to temporarily store data during operations of the controller 18. The host 26 can be a computer system being capable of accessing data on the optical disk 22 by commanding the controller 18. Data on the optical disk 22 will be written on a track 24. When the motor 12 drives the optical disk 22 to rotate and make the track 24 skip on the pickup head 16, the controller 18 can analyze the data recorded on the optical disk 22, buffering the data in the memory 20 temporarily, and deliver the data to the host 26.
In order to record data on the optical disk 22, the host 26 transfers data to the drive 10 to buffer the data temporarily in the memory 20. Then the controller 18 can according to the data temporarily stored in the memory 20 control the pickup head 16 to write the data onto the track 24.
Defects may be caused by many reasons when data is written onto an optical disk such that data will not be able to be written to defective blocks correctly. In order to maintain data recording function of an optical disk, a systematic method must be applied to manage defects. For example, spare blocks can be predefined on a track of an optical disk. When defects occur on the optical disk, data can be recorded on these spare blocks in replace. Please refer to FIG. 1 and FIG. 2. FIG. 2 is a schematic diagram according to an embodiment of defining spare blocks on the track 24 on the optical disk 22. In general, a Lead-In Area, LI, and a Lead-Out Area, LO, are provided in the head and the tail of the track 24 respectively. Between the two areas, a program area, program area PA, is provided to record data. As mentioned above, in order to prevent data from being lost on the track 24 because of the defects, the program area PA, can be divided into one or several spare area packets, SA (a plurality of spare area packets are labeled as SA (1), SA (2) . . . SA (n) on FIG. 2). In order to write data to the optical disk 22, the space left in the program area, PA, can be divided to one or several data area packets, DA (A plurality of data area packets are labeled as DA (1), DA(2) . . . DA(n) on FIG. 2). In order to more easily manage data accessing, each data area packet DA, and each spare area packet, SA, can be further divided into a plurality of data packets, Pd, and spare packets, Ps, wherein a data block Bd, is the basic data-recording unit in a data packet Pd, and a spare data block, spare data block Bs, is the basic data-recording unit in a spare packet Ps. For example, each data block Bd, and each spare data block Bs, can be an area being capable of recording one or several kilobytes on the track 24. A number of spare data blocks Bs, or spare packets Ps, can be accumulated to make up a spare packet Ps, and a spare area packet SA, respectively. Similarly, as illustrated in FIG. 2, a data block Bd, a data packet Pd, and a data area packet DA, are organized in the same way. During operation, each data block Bd, and spare data block Bs, on the track 24 can be assigned with different address such as physical block number, according to their arrangement order. For convenience, a spare data block Bs, can be provided to have identical data capacity of a data block Bd so that one defect data block Bd, can be replaced by one spare data block Bs. Therefore, a spare packet Ps, will have the same capacity to a data packet Pd.
When the optical disk 22 is rotated, the pickup head 16 will skip every part of the track 24, as an arrow A1 illustrated in FIG. 2. The principle of defect management of optical disks can be expressed as follows. If a user assigns data to be written on the optical disk 22, the data will be written to each data block Bd of each data area packet DA. If the drive 10 recognizes defects in a data block Bd so that data cannot be recorded concisely, the drive 10 can find one spare data block Bs in a spare area packet SA to replace the data block Bd having defects. Then data will be recorded to this replacing spare data block Bs. Certainly, the relationship of the data block Bd having defects and the replacing one should be recorded on the optical disk 22. As illustrated in FIG. 2, a Main Table Area, MTA, and a Secondary Table Area, STA, are further provided on the track 24 to record a defect table DT and its backup. The relationship between each defective data block Bd and its corresponding replacing spare data block Bs is recorded in the defect table DT. If there are a plenty of defective Bds on the optical disk 22, the defect table DT can record each relationship between each defective data block Bd and its corresponding replacing spare data block Bs. When accessing data on the optical disk 22, if defects occur in a data block Bd, the drive 10 can according to the relationship recorded in the defect table DT find out address of the replacing Bsand access data stored in the spare data block Bs. Applying this method, even if there are defect data blocks Bd, the drive 22 can still record data correctly. Except for a data block Bd, a spare data block Bsin each data area packet DA may also be defective and fail to record data. This defective spare data block Bs must be replaced by another normal spare data block Bs.
Please refer to FIG. 3. FIG. 3 is a schematic diagram of a prior art defects management method flow 100 when the drive 10 performs data recording. The flow 100 is as follows:
Step 102: If the drive 10 recognizes defective areas being unable to be applied to record data concisely, the step starts. The defective area can be a defective data block Bd or a defective spare data block Bs.
Step 104: According to the defective area, search for a replacing spare data block Bs and the spare area packet SA where the replacing spare data block Bs is located. If the defective area recognized in step 102 is a new defective area without a corresponding spare data block Bs and any record in the defect table DT, anewBs, which has not been used to replace any defective area, will be used to replace the defective area recognized in step 102. It is possible that one normal area on the rewritable optical disk still functions well when data is written onto the area at first, but then the area turns out to be fault when new data is written to that area again. Such area is a new detected defective area. Since the area functioned well at first, the defect table DT cannot recognize it as a defective one. Such “new detected defective area” can be called as an unregistered defective area, meaning that the defect table DT has not recorded it. When defects management is performed on that new detected defective area, the new detected defective area will be assigned with a corresponding spare area, and the defect table DT will record the relationship. The defective area then becomes a registered defective area. If the defective area recognized in step 102 is a registered defect area already, the defect table DT can find a corresponding spare area according to the record in this step.
Step 106: Transfer data in the spare area of spare area packet SA found in step 104 to the memory 20 of drive 10. Please refer to FIG. 1 at the same time. If each spare data block Bs and data block Bd are memory units having less memory, the drive 10 can more efficiently make use of memory space on the track 24. However, the cooperative operations of the drive 10 must work very precisely in order to transfer data to a smaller data block Bd or spare data block Bs. It may demand too much to fulfill. Thus, in practicing, the drive 10 always takes one program area PA or spare area packet SA as one unit to transfer data to the optical disk 22. For example, when data are already stored in three spare data blocks Bs in a spare area packet SA and the drive 10 has to transfer new data to the 4th spare data block Bs in the spare area packet SA, the drive 10 has to move the data stored in the previous 3 spare data blocks Bs to the memory 20, combine the previous data with the new 4th data as a unit, and transfer the combined unit back to that spare area packet SA. In other words, the previous data stored in the three spare data blocks Bs will be transferred repeatedly. In this step, the spare area packet SA has to be transferred to the memory 20 so that after the data is refreshed, the refreshed data collected from each spare data block Bs will be transferred to the optical disk 22 as a spare area packet SA unit.
Step 108: To the defective area mentioned in step 102, the corresponding spare data block Bs and its spare area packet SA have to be written to the memory 20. The data meant to be written to that defective area will be copied to a spare area packet SA of the memory 20 and acts as a unit. The refreshed data stored in the spare area packet SA will be rewritten to the track 24 on the optical disk 22.
Step 110: If other defective spare data blocks Bs are detected in the rewriting procedure of step 108, go back to step 102 and work on the detected defects of spare data block Bs. If it goes well in step 108 and finds no other defective spare data block Bs, the process can go on to step 112. Other unregistered defective spare data block Bs might be detected in step 108 when data is rewritten to a spare area packet SA. The procedure has to go back to step 102 to deal with the detected defective spare data block Bs.
Step 112: If the rewriting procedure goes well in step 108, the spare area packet SA applied for transferring data of the memory 20 in step 106 can be released. The occupied memory of the spare area packet SA can be released to buffer other data.
Step 114: Return to step 102 if other defect area has to be deal with. If not, go to step 116.
Step 116: End.
Please refer to FIG. 4A to FIG. 4C. Illustrated in FIG. 4A to FIG. 4C are schematic diagrams of associated data assignments on the track 24 of the optical drive 20 in the prior art flow 100. As illustrated in FIG. 4A, when the drive 10 transfers data to a data packet Pd1, the data will be buffered in the memory 20 and transferred to the data packet Pd1 through the pickup head 16(please refer to FIG. 1). In FIG. 4A, data in the memory 20 meant to be transferred to data block Bd1, Bd2, and Bd3 in the data packet Pd1 is marked by “( )”. If the drive 10 detects the data block Bd2 as a defective block, the flow 100 will be initiated. As illustrated in FIG. 4B, if in step 104, it has been decided to replace the data block Bd2 with the spare data block Bs3 in the spare packet Ps1, data in the spare packet Ps1 will be transferred to the memory 20 in step 106. Similarly, in FIG. 4B, data in the memory 20 meant to be transferred to the spare packet Ps1 and the spare data blocks Bs1 and Bs2, is marked by “( )”. In step 108, data meant to be transferred to the defective data block Bd2 will be copied to the spare packet Ps1 in the memory 20. Then, as illustrated in FIG. 4C, data in the spare packet Ps1 of the memory 20 will be refreshed and transferred to the track 24 in step 108. Data meant to be transferred to the defective data block Bd2 will be recorded in the spare data block Bs3. If the defective data block Bd2 is unregistered, the relationship of the data block Bd2 and the spare data block Bs3 must be recorded in the defect table DT. Ideally, defects management on the data block Bd2 performed in step 108 can be terminated if no other defective spare data block Bs is being detected. The memory space of the memory 20 occupied bathe spare packet Ps1 will be released in step 112.
According to the discussion above, the prior art flow 100 handles one defect at a time. A spare area packet SA buffered in the memory 20 can be released only if no further defects are detected in step 108. In an ideal condition, the prior art flow 100 will not occupy too much memory space in the memory 20 for spare area packet SA, which is meant for transferring to drive 10. However, in practice, a spare data block Bs in a spare area packet SA might be a defect. Basically, the possibility for a spare data block Bs to be defective is identical for a data block Bd to be defective. In this condition, the prior art flow 100 might unceasingly occupy the memory space in the memory 20 to buffer spare area packets SA in order to manage defects.
Please refer to FIG. 5A to FIG. 5E. Illustrated in FIG. 5A to FIG. 5E is a more realistic schematic diagram of data allocation arrangement between the track 24 and the memory 20 of the prior art flow 100. As illustrated in FIG. 5A, it assumes that the drive 10 detects two defective data blocks Bd2 and Bd3 in the data packet Pd1 when data buffered in the memory 20 are transferred to the data packet Pd1. For the prior art flow 100 can only performs defects management for one block at time, we assume here that the drive 10 performs defects management on the data block Bd2 at first, and in step 104, a spare area packet SA in the spare packet Ps1 is determined to replace the defective data block Bd2. In step 106, the drive 10 allocates a memory space in the memory 20 for the spare area packet SA to buffer data from the spare packet Ps1 to the memory 20. In step 108, the drive 10 will copy the data meant to be transferred to the data block Bd2 to a temporal spare packet Ps1 in the memory 20. As illustrated in FIG. 5B, in step 108, the temporal storage memory Ps1 in the memory 20 will be transferred back to the spare packet Ps1 on the track 24.
To be much closer to the real situation, we assume that the drive 10 detects another two defective spare data blocks Bs1 and Bs3 during the retransferring procedure in step 108. In order to apply defects management on these two spare data blocks Bs, the flow 100 will go from step 110 to step 102. Since the spare packet Ps1 buffered in the memory 20 still stores backup data of the spare data blocks Bs1 and Bs3, the spare packet Ps1 cannot be released from the memory 20. Because the flow 100 can only deals with one defective area at a time, in this case, we assume that the flow 100 performs its defects management on the spare data block Bs1 first. As illustrated in FIG. 5C, when the flow 100 goes from step 102 to step 104 again, in order to replace the defective spare data block Bs1 with the spare data block Bs4 in the spare packet Ps2, again the drive 10 has to allocate a spare area packet SA in the memory 20 in step 106. In step 108, as illustrated in FIG. 5D, data in the spare data block Bs1 will be transferred to the replacing spare data block Bs4. If two more defective spare data block BsS and Bs6 have been detected during the retransferring procedure, the flow 100 has to go back to step 102. At the same time, the spare packet Ps2 still occupies the memory 20 because the data of the spare data blocks Bs5 and Bs6 are unable to be released.
If the flow 100 decides to replace the defective spare data block Bs5 with a spare data block Bs7 in the spare packet Ps3, the stored data must be transferred to the memory 20 in step 106, and the original data stored in the spare data block Bs5 has to be copied to the spare packet Ps3 in the memory 20. In FIG. 5E, the refreshed spare packet Ps3 in the memory 20 will be written to the spare packet Ps3 in order to transfer data from the spare data block Bs5 to the spare data block Bs7. If another defect is detected in the spare packet Ps3, neither the spare packet Ps3 in the memory 20 nor a new memory space can be released. A further memory space for a spare area packet SA has to be allocated for a new spare area packet SA to be transferred by. Only if no further defects are detected when the spare packet Ps3 is rewritten can the spare packet Ps3 in the memory 20 be released. The flow 100 has to go back from step 114 to step 102 to perform defects management on the spare data blocks Bs6, Bs3, and other Bd3 associated defects management. As shown in FIG. 5A to FIG. 5E, due to that the flow 100 can only cope with one defect, spare area packets SA buffered in the memory 20 cannot be released. To deal with continuous incidents of defects detected in step 108, it costs too many resources of the memory 20. For example, from FIG. 5A to FIG. 5E, due to that the flow 100 can only deal with one defect at once, data in the spare data block Bs3 and Bs6 in the memory 20 cannot be released and occupies memory resources of the memory 20 unceasingly.
Therefore, the prior art flow 100 cannot make use of memory space of the memory 20 effectively and waste memory resources continuously. Defects management cannot be done effectively and operation efficiency of the drive 10 will deteriorate.